﻿using PortalBusiness.Migrations;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Web;

namespace PortalBusiness.Models
{
    public class PortalBusinessContext : DbContext
    {
        // You can add custom code to this file. Changes will not be overwritten.
        // 
        // If you want Entity Framework to drop and regenerate your database
        // automatically whenever you change your model schema, please use data migrations.
        // For more information refer to the documentation:
        // http://msdn.microsoft.com/en-us/data/jj591621.aspx
    
        public PortalBusinessContext() : base("name=PortalBusinessContext")
        {
            
        }
        static PortalBusinessContext()
        {

            //Database.SetInitializer<PortalBusinessContext>(new DropCreateDatabaseIfModelChanges<PortalBusinessContext>());
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<PortalBusinessContext, Configuration>());

        }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {

            base.OnModelCreating(modelBuilder);

            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();



        }

        public System.Data.Entity.DbSet<USUARIO> USUARIOs { get; set; }

        public System.Data.Entity.DbSet<TITULO> TITULOes { get; set; }

        public System.Data.Entity.DbSet<COLUNA> COLUNAs { get; set; }

        public System.Data.Entity.DbSet<CAIXA> CAIXAs { get; set; }

        public System.Data.Entity.DbSet<NATUREZASTART> NATUREZAs { get; set; }

        public System.Data.Entity.DbSet<PortalBusiness.Models.PENDENCIA> PENDENCIAs { get; set; }

        public System.Data.Entity.DbSet<FORNECEDOR> FORNECEDORs { get; set; }

    
    }
}
